package SparkExercises.kejian6;

import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;

public class LianXi {
    public static void main(String[] args) {
        /**
         * 基于文件，
         * 从中查找姓名的首字母是A的且年龄为20岁或者性别为女的学生，
         * 并显示出name、age、sex这三列数据
         */
        SparkSession session = SparkSession.builder().appName(LianXi.class.getName()).master("local").getOrCreate();
        Dataset<Row> dataset = session.read().json("./data/student.json");

        dataset.where("name like 'A%' and ( age = 20 or sex = '女')")
                .select("name","age","sex")
                .show();

    }
}
